// $Id: loggerrequestfailpopularity.h 71 2004-11-23 14:36:02Z hansemil $
#ifndef LOGGERREQUESTFAILPOPULARITY_H
#define LOGGERREQUESTFAILPOPULARITY_H

#include "loggercount.h"
#include "eos.h"
#include <fstream>

/// The number of popularity-partitions to use in logging
const int m_partitions = 10;

/**
 * Logs the request fails for each tick based on file popularity. The files are divided into a number of partitions depending on their aproximated popularity.
 * @warning The correct enterpretaion of the output of this logger will change depending on the filehandler/distribution used.
 */
class LoggerRequestFailPopularity : public Logger {
public:
	LoggerRequestFailPopularity();
	void eos_simulate_start(void *);
	void eos_simulate_stop(void *);
	void clock_tick(unsigned int);
	void node_requestFile(void *, void *, bool);

private:
	void resetVars();
	Eos *m_eos;
	std::fstream m_fout;
	int m_countRequestFail[m_partitions];
	int m_countRequestSuccess[m_partitions];
};

#endif
